package com.Ling.Thread.sync;

/**
 * File Name: RunnableDemo
 * Date: 2020-06-29 15:25
 * Author: liangling
 * Description 实现Runnable接口多线程
 */
public class RunnableDemo {


    public static void main(String[] args) {
        new Thread(new MyRunnable()).start();
    }
}

class MyRunnable implements Runnable {

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + "  子线程启动");

        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName() + ":" + i);
        }

    }
}






//        //lamda表达式
//       new Thread(()-> System.out.println(Thread.currentThread().getName()+"子线程")).start();
//          new Thread(new RunnableDemo()).start();